package com.tao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tao.dao.CategoryMapper;
import com.tao.entity.Category;
import com.tao.service.CategoryService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author  诸葛先生
 * 功能：分类展示业务逻辑
 */
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {

    @Override
    public List<Category> getCategoryList() {
        LambdaQueryWrapper<Category> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(Category::getId,Category::getName);
        List<Category> categoryList = this.baseMapper.selectList(queryWrapper);
        if (categoryList != null && !categoryList.isEmpty()) {
            return categoryList;
        }
        return null;
    }
}
